<?php
/**
 * 控制器调用
 * @param str $name   [description]
 * @param str $method [description]
 */
function C($name, $method)
{
	require_once 'libs/Controller/' . $name . 'Controller.class.php';
	//eval('$obj = new ' . $name . 'Controller();$obj->' . $method . '();'); //ecal()函数调用简单但是不安全
	$controller = $name . 'Controller';
	$obj = new $controller();
	$obj->$method();
}
/**
 * 模型调用
 * @param str $name [description]
 */
function M($name)
{
	require_once 'libs/Model/' . $name . 'Model.class.php';
	$model = $name . 'Model';
	$obj = new $model();
	return $obj;
}
/**
 * 视图调用
 * @param str $name [description]
 */
function V($name)
{
	require_once 'libs/View/' . $name . 'View.class.php';
	$view = $name . 'View';
	$obj = new $view();
	return $obj;
}

function ORG($path, $name, $params=array()){// path 是路径  name是第三方类名 params 是该类初始化的时候需要指定、赋值的属性，格式为 array(属性名=>属性值, 属性名2=>属性值2……)
	require_once('libs/ORG/'.$path.$name.'.class.php');
	//eval('$obj = new '.$name.'();');
	$obj = new $name();
	if(!empty($params)){
	foreach($params as $key=>$value){
			//eval('$obj->'.$key.' = \''.$value.'\';');
			$obj->$key = $value;
		}
	}
	return $obj;
}
/**
 * 转译
 * @param  str $str [description]
 * @return str      [description]
 */
function daddslashes($str)
{
	return (!get_magic_quotes_gpc()) ? addslashes($str) : $str;
}